package org.bizming.medicine.service;

import java.util.List;

import org.bizming.base.BaseErrCode;
import org.bizming.base.BaseException;
import org.bizming.medicine.dao.OfferCompanyDao;
import org.bizming.medicine.model.help.ActionType;
import org.bizming.medicine.model.help.OfferCompany;

public class OfferCompanyServiceImpl implements OfferCompanyService {

	private OfferCompanyDao offerCompanyDao;

	public boolean add(OfferCompany offerCompany) throws BaseException {
		if (!offerCompany.isValidate(ActionType.ADD)) {
			throw new BaseException(BaseErrCode.INVALIDATE);
		}
		return offerCompanyDao.add(offerCompany);
	}

	public boolean update(OfferCompany offerCompany) throws BaseException {
		if (!offerCompany.isValidate(ActionType.UPDATE)) {
			throw new BaseException(BaseErrCode.INVALIDATE);
		}
		return offerCompanyDao.update(offerCompany);
	}

	public OfferCompany get(int id) {
		return offerCompanyDao.get(id);
	}

	public boolean remove(int id) {
		return offerCompanyDao.remove(id);
	}

	public List<OfferCompany> selectList() {
		return offerCompanyDao.selectList();
	}

	// =======================================
	public OfferCompanyDao getOfferCompanyDao() {
		return offerCompanyDao;
	}

	public void setOfferCompanyDao(OfferCompanyDao offerCompanyDao) {
		this.offerCompanyDao = offerCompanyDao;
	}

}
